Package org.python.pydev.editor.actions

Source Code of org.python.pydev.editor.actions.PyToggleForceTabs

/**
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Eclipse Public License (EPL).
* Please see the license.txt included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package org.python.pydev.editor.actions;

import org.eclipse.jface.action.IAction;
import org.python.pydev.core.IIndentPrefs;
import org.python.pydev.editor.PyEdit;

public class PyToggleForceTabs extends PyAction {

    public void run(IAction action) {
        if (targetEditor instanceof PyEdit) {
            PyEdit pyEdit = (PyEdit) targetEditor;
            IIndentPrefs indentPrefs = pyEdit.getIndentPrefs();
            indentPrefs.setForceTabs(!indentPrefs.getForceTabs());
            updateActionState(indentPrefs);
        }
    }

    private void updateActionState(IIndentPrefs indentPrefs) {
        //This doesn't work! (setChecked and setImageDescriptor don't seem to update the action in the pop up menu).
        //    setChecked(forceTabs);
        //    setImageDescriptor(desc);

        PyEdit pyEdit = getPyEdit();
        pyEdit.updateForceTabsMessage();
    }

}
TOP

Related Classes of org.python.pydev.editor.actions.PyToggleForceTabs

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.